//在这里把2个reducer合并成同一个reducer
import {combineReducers, AnyAction, ReducersMapObject} from 'redux';
import counter1,{Counter1State} from './counter1';
import counter2,{Counter2State} from './counter2';

//这个就是合并后的状态类型定义
export interface CombinedState {
    counter1: Counter1State
    ;counter2: Counter2State;
}

const reducers: ReducersMapObject<CombinedState,AnyAction> = {
  counter1
  , counter2
};

const rootReducer = combineReducers<CombinedState,AnyAction>(reducers);
/*
合并后的状态
{
    counter1:{number:0}
    ,counter2:{number:0}
}
*/
export default rootReducer;
